package club.itstudio.itouc.controller.jw.course

import club.itstudio.itouc.core.util.Result
import club.itstudio.itouc.core.util.ResultUtil
import club.itstudio.itouc.util.Mysql
import club.itstudio.itouc.util.Redis
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RestController

/**
 * 获取专业课
 */
@RestController
class Specialty(val mysql: Mysql,
                val redis: Redis) {
    @GetMapping("/jw/course/specialty/{grade}/{specialtyCode}")
    fun specialtyCourse(@PathVariable grade: String,
                        @PathVariable specialtyCode: String): Result<Any> {
        val classNumList = mysql.getSpecialtyCourse(grade, specialtyCode)
        val courseList = redis.getCourseList(classNumList)
        return ResultUtil.success(courseList)
    }
}